@model Sio.Cms.Lib.ViewModels.SioProducts.ReadMvcViewModel
@{
    string culture = ViewBag.culture;
    ViewData["Title"] = Model.Title;
    ViewData["SeoTitle"] = Model.SeoTitle;
    ViewData["SeoKeywords"] = Model.SeoKeywords;
    ViewData["SeoDescription"] = Model.SeoDescription;
}
<preview-popup ng-if="isInit" preview-object="previewObject"></preview-popup>
@if (!string.IsNullOrEmpty(Model.TemplatePath))
{
    try
    {
        await Html.RenderPartialAsync(Model.TemplatePath, Model);
    }
    catch (Exception ex)
    {

        <p class="danger text-center has-error">@ex.StackTrace</p>
    }
}
else
{
    <section class="container">
        <h1>@SioService.Translate("Please choose template", ViewBag.culture)</h1>
    </section>
}
@section Styles{
    <link rel="stylesheet" href="~/css/app-vendor.min.css" />
    <base href="/@ViewBag.culture">
    @if (!string.IsNullOrEmpty(SioService.GetConfig<string>("GA_KEY", ViewBag.culture)))
    {
        <!-- Google Analytics -->
        <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', '@(SioService.GetConfig<string>("GA_KEY", ViewBag.culture))', 'auto');
        ga('send', 'pageview');
        </script>
        <!-- End Google Analytics -->
    }
    <div id="fb-root"></div><div id="fb-root"></div><div id="fb-root"></div>
    <script>
        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.1&appId=1471411989648473&autoLogAppEvents=1';
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
    @if (!string.IsNullOrEmpty(SioService.GetConfig<string>("FacebookAppId", ViewBag.culture)))
    {
        <script>
        window.fbAsyncInit = function () {
            FB.init({
                appId: '@(SioService.GetConfig<string>("FacebookAppId", ViewBag.culture))',
                autoLogAppEvents: true,
                xfbml: true,
                version: 'v3.2'
            });
        };

        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) { return; }
            js = d.createElement(s); js.id = id;
            js.src = "https://connect.facebook.net/en_US/sdk.js";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
        </script>
    }
    @Html.Raw(Model.View?.Styles)
}
